extends Area2D

@onready var timer: Timer = $Timer

# 玩家进入死亡区域时，重新开始游戏
func _on_body_entered(body: Node2D) -> void:
	print("You died!")
	Engine.time_scale = 0.5
	body.get_node("CollisionShape2D").queue_free()
	body.call("play_die_sound")
	timer.start()
	
# 重新开始游戏（加载场景）
func _on_timer_timeout() -> void:
	Engine.time_scale = 1.0
	get_tree().reload_current_scene()
